#include<iostream>
#include<string>
using namespace std;

class Solution {
public:
    string getSmallestString(string s, int k)
    {
        if (k == 0) return s;
        for (int i = 0; i < s.size(); i++)
        {
            int gap = min(s[i] - 'a', 26 - (s[i] - 'a'));
            if (gap <= k)
            {
                k -= gap;
                if (gap == s[i] - 'a') s[i] -= gap;
                else if (gap == 26 - (s[i] - 'a')) s[i] -= 26 - gap;
            }
            else
            {
                s[i] -= k;
                break;
            }
        }
        return s;
    }
};